using System.Collections.Generic;

namespace OracleInternal.SqlAndPlsqlParser.LocalParsing
{
	internal class OracleLpCompoundUnaryExpression : OracleLpCompoundExpression
	{
		protected OracleLpCompoundExpressionUnaryOperator m_vUnaryOperator;

		protected OracleLpExpression m_vOperand;

		public OracleLpCompoundExpressionUnaryOperator UnaryOperator
		{
			get
			{
				return m_vUnaryOperator;
			}
			set
			{
				m_vUnaryOperator = value;
			}
		}

		public OracleLpExpression Operand
		{
			get
			{
				return m_vOperand;
			}
			set
			{
				m_vOperand = value;
				if (value != null)
				{
					value.ParentExpression = this;
				}
			}
		}

		public OracleLpCompoundUnaryExpression(OracleLpStatementElement parent)
			: base(parent)
		{
			m_vCompoundType = OracleLpCompoundExpressionType.UNARY;
		}

		public override void EvaluateDatatype()
		{
			if (m_vOperand != null)
			{
				m_vOperand.EvaluateDatatype();
			}
		}

		public override IList<OracleLpExpression> GetAllTerminalExpressions()
		{
			if (m_vAllTerminalExpressions == null)
			{
				m_vAllTerminalExpressions = m_vOperand.GetAllTerminalExpressions();
			}
			return m_vAllTerminalExpressions;
		}
	}
}
